<?php
/**
 * System_Model_DbTable_RoleResource
 *
 * @author maomao.thx@gmail.com
 * @copyright Copyright (c) 2009 Green Shore (http://www.iwgame.com)
 * @version $Id: RoleResource.php 214 2011-04-02 06:38:29Z mmxie $
 */
class System_Model_DbTable_RoleResource extends IG_Model_DbTable
{

    protected $_name = 'sys_role_resource';

    public $_primary = 'role_id';

    protected $_referenceMap = array(
        'Role' => array(
            'columns' => 'role_id',
            'refTableClass' => 'System_Model_DbTable_Role',
            'refColumns' => 'role_id'
        ),
        'Resource' => array(
            'columns' => 'resource_id',
            'refTableClass' => 'System_Model_DbTable_Resource',
            'refColumns' => 'resource_id'
        )
    );

    public function getResourceIds($id)
    {
        return $this->select()
                    ->from($this->_name, 'resource_id')
                    ->where('role_id=?', $id)
                    ->query()
                    ->fetchAll(Zend_db::FETCH_COLUMN);
    }
}

